home *** CD-ROM | disk | FTP | other *** search
/ Meeting Pearls 1 / Meeting Pearls Vol 1 (1994).iso / installed_progs / linux / tools / amiga / gzip-1.1.2.lha / gzip-1.1.2 / zmore.in < prev    next >
Encoding:
Text File  |  1993-06-03  |  967 b   |  48 lines

  1. :
  2. #!/bin/sh
  3.  
  4. if test "`echo -n a`" = "-n a"; then
  5.   # looks like a SysV system:
  6.   n1=''; n2='\c'
  7. else
  8.   n1='-n'; n2=''
  9. fi
  10. if stty -cbreak 2>/dev/null; then
  11.   cb='cbreak'; ncb='-cbreak'
  12. else
  13.   # 'stty min 1' resets eof to ^a on both SunOS and SysV!
  14.   cb='min 1 -icanon'; ncb='icanon eof ^d'
  15. fi
  16. oldtty=`stty -g 2>/dev/null`
  17. if test $? -eq 0 -a -n "$oldtty"; then
  18.    trap 'stty -g $oldtty 2>/dev/null; exit' 0 2 3 5 10 13 15
  19. else
  20.    trap 'stty $ncb echo 2>/dev/null; exit' 0 2 3 5 10 13 15
  21. fi
  22.  
  23. if test $# = 0; then
  24.     gzip -cd | eval ${PAGER-more}
  25. else
  26.     FIRST=1
  27.     for FILE
  28.     do
  29.     if test $FIRST -eq 0; then
  30.         echo $n1 "--More--(Next file: $FILE)$n2"
  31.         stty $cb -echo 2>/dev/null
  32.         ANS=`dd bs=1 count=1 2>/dev/null` 
  33.         stty $ncb echo 2>/dev/null
  34.         echo " "
  35.         if test "$ANS" = 'e' -o "$ANS" = 'q'; then
  36.             exit
  37.         fi
  38.     fi
  39.     if test "$ANS" != 's'; then
  40.         echo "------> $FILE <------"
  41.         gzip -cd "$FILE" | eval ${PAGER-more}
  42.     fi
  43.     if test -t; then
  44.         FIRST=0
  45.     fi
  46.     done
  47. fi
  48.